# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=changeme
pkgver=272.26fa2c3
pkgrel=1
groups=('blackarch' 'blackarch-scanner')
pkgdesc='A default credential scanner.'
arch=('any')
url='https://github.com/ztgrace/changeme'
license=('GPL3')
depends=('python' 'python-python-libnmap' 'python-lxml' 'python-netaddr'
         'python-requests' 'python-nose' 'python-schema' 'python-logutils'
         'python-cerberus' 'python-tabulate' 'python-paramiko' 'python-yaml'
         'python-sqlalchemy' 'python-mock' 'python-pysnmp' 'python-shodan'
         'python-memcached' 'python-redis' 'python-pymongo' 'python-jinja'
         'python-selenium' 'python-pyodbc')
makedepends=('git')
source=("git+https://github.com/ztgrace/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 -t "$pkgdir/usr/share/man/man1/" "$pkgname.1"
  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"

  rm README.* COPYING "$pkgname.1"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

